<?php
namespace app\api\controller;
use think\Db;
use app\admin\model\Config;

//专家智库
class Zhuanjia extends App
{
    
    
    public function index()
    {
        $pagesize = 10;
        $page = $this->request->get("page",0,'intval'); 
		
		
		$map['status'] = 1;
		$map['groupid'] = 2;
        $count = Db::name("admin")->where($map)->count();
		$list = Db::name("admin")->where($map)->field('id,real_name,zj_job,portrait')->order('id desc')
			->page($page,$pagesize)->select();  
			
		$list = array_map(function ($rs){
            /* $rs["create_time"] = !empty($rs["create_time"])?date('Y-m-d H:i',$rs["create_time"]):'';
			
			$photos = explode(',',$rs['photo']);
			$photos = array_filter($photos);
			foreach($photos as $kp=>$vp){ 
				$photos[$kp] = config('app_host').$vp;
			}
			$rs['photo_count'] = count($photos); */
			$rs['portrait'] = config('app_host').'/uploads/face/'.$rs['portrait'];
			$rs['zj_job'] = explode('|',$rs['zj_job']);
			
            return $rs;
        }, $list);		
			
        $pages = ceil($count/10);
        $data = array('list'=>$list,'count'=>$count,'pages'=>$pages,'pagesize'=>$pagesize);
		return $this->show(1,"成功", $data);
		
    }
    
    
}